using System;
using System.IO;
using System.Text;
using OracleInternal.Json.Common;

namespace OracleInternal.Json.Sql
{
	internal class OracleJsonStringNumber : OracleJsonDecimal
	{
		private string m_value;

		internal OracleJsonStringNumber(string value)
		{
			m_value = value;
		}

		internal override string GetJsonString()
		{
			return m_value;
		}

		public override OracleJsonType GetOracleJsonType()
		{
			return OracleJsonType.DECIMAL;
		}

		internal override decimal BigDecimalValue()
		{
			return Convert.ToDecimal(m_value);
		}

		internal void Serialize(StringBuilder s)
		{
			try
			{
				s.Append(m_value);
			}
			catch (IOException ex)
			{
				throw OracleJsonExceptions.IO.Create(GetExceptionFactory(), ex);
			}
		}

		internal override TargetType GetTargetType()
		{
			return TargetType.NONE;
		}
	}
}
